const { sign, verify } = require('jsonwebtoken')
const { SECRET_KEY } = require('../contants')

exports.sign = function(username) {
    return sign({
        username,
        timestamp: Date.now(),
    }, SECRET_KEY)
}

exports.verify = function(token) {
    return verify(token, SECRET_KEY)
} 